package com.sankuai.core.conf;

import com.sankuai.core.scheduler.XxlJobScheduler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

/**
 * @Author：YH
 * @Description：
 * @Date:Created in 2022/5/19 20:04
 */
@Component
public class XxlJobAdminConfig implements InitializingBean, DisposableBean {

    private static final Logger LOGGER = LoggerFactory.getLogger(XxlJobAdminConfig.class);

    //singleton
    private static XxlJobAdminConfig adminConfig = null;

    public static XxlJobAdminConfig getAdminConfig() {
        return adminConfig;
    }

    // ---------------------- XxlJobScheduler ----------------------
    private XxlJobScheduler xxlJobScheduler;

    @Override
    public void afterPropertiesSet() throws Exception {
        LOGGER.info("XxlJobAdminConfig afterPropertiesSet bean属性后置方法");
        xxlJobScheduler = new XxlJobScheduler();
        xxlJobScheduler.init();
    }


    @Override
    public void destroy() throws Exception {

    }
}
